<template>
  <!-- 医生门诊 -->
  <section v-if="doctorInfo" class="reservecentre">
    <el-tabs v-model="tabsIndex" type="border-card">
      <el-tab-pane name="0" label="今日病人">
        <todayPatient v-if="tabsIndex==0" :doctorInfo="doctorInfo"></todayPatient>
      </el-tab-pane>
      <el-tab-pane name="1" label="历史记录">
        <historyRecord v-if="tabsIndex==1" :doctorInfo="doctorInfo"></historyRecord>
      </el-tab-pane>
    </el-tabs>
    <div class="btn-tool">
      <el-button type="primary" size="small" @click="dialogCall=true">呼叫下一位</el-button>
      <!-- <el-button type="primary" size="small">快速接诊</el-button> -->
    </div>
    <dialogCall v-model="dialogCall" :doctorId="doctorInfo.id"></dialogCall>
  </section>
</template>
<script>
export default {
  components: {
    todayPatient: () => import("./_com/todayPatient.vue"),
    historyRecord: () => import("./_com/historyRecord.vue"),
    dialogCall: () => import("./_com/dialogCall.vue")
  },
  data() {
    return {
      tabsIndex: "0",
      dialogCall: false,
      qxBtns: {},
      doctorInfo: null
    };
  },
  async created() {
    let th = this;
    let doctor = await th.$api.getDoctorByToken();
    if (doctor.executed) {
      th.doctorInfo = doctor.info;
      th.getQX();
    } else {
      th.$message.warning("检测到您不是医生");
      th.addNavMenu("工作台", "/page/index", "index");
      th.$router.push("/page/index");
    }
  },
  mounted() {}
};
</script>
<style lang="scss" scoped>
.reservecentre {
  position: absolute;
  width: 100%;
  left: 0;
  top: 0;
  height: 100%;
  background-color: transparent !important;
  .btn-tool {
    position: absolute;
    right: 20px;
    top: 19px;
  }
}
</style>